package com.snimay.heibernate;

import javax.persistence.EntityManagerFactory;

import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Scope;

@Configuration
@Scope("prototype")
public class HibernateConfig {
    
	/*@Autowired
	private SessionFactory sessionFactory;*/
    @Bean
    public SessionFactory sessionFactory(@Qualifier("entityManagerFactory") EntityManagerFactory emf){
    //	System.out.println("=================EEEEEEEEEEEEEEEEEE===========");
        return emf.unwrap(SessionFactory.class);
    }
    
    
    @Bean
    public ModelService modelService(){
         return new ModelService();
    } 
}
